package com.gitee.wsl.ext.list

import com.gitee.wsl.ext.array._rotateRight

fun <T> MutableList<T>.rotateLeft(offset: Int = +1) = rotateRight(-offset)

fun <T> MutableList<T>.rotateRight(offset: Int = +1) = _rotateRight(size, offset) { start, end -> reverse(start, end) }

fun <T> List<T>.rotatedLeft(offset: Int = +1): List<T> = toMutableList().also { it.rotateLeft(offset) }

fun <T> List<T>.rotatedRight(offset: Int = +1): List<T> = toMutableList().also { it.rotateRight(offset) }
